<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>增加字段</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<script language="javascript">
var notAllow = " <?php echo $f; ?> ";
function GetFields()
{
	var theform = document.form1;
	var fieldname = theform.fieldname.value;
	var itemname = theform.itemname.value;
	var dtype = 'text';
	var enums = document.getElementsByName('dtype');
	for(i=0;i<enums.length;i++)
	{
		if(enums[i].checked) dtype = enums[i].value;
	}
	var isnull = theform.isnull.value;
	var vdefault = theform.vdefault.value;
	var maxlength = theform.maxlength.value;
	var vinnertext = theform.vinnertext.value;
	
	
	var issearch = (theform.issearch[0].checked ? theform.issearch[0].value : theform.issearch[1].value);
	var isshow = (theform.isshow[0].checked ? theform.isshow[0].value : theform.isshow[1].value);
	var state = (theform.state[0].checked ? theform.state[0].value : theform.state[1].value);
	var sisnull = (isnull==0 ? "false" : "true");
	
	if(itemname=="")
	{
		alert("表单提示名称不能为空！");
		theform.itemname.focus();
		return false;
	}
	
	if(fieldname=="") 
	{
		alert("字段名称不能为空！");
		theform.fieldname.focus();
		return false;
	}
	
	if(notAllow.indexOf(" "+fieldname+" ") >-1 ) 
	{
		alert("字段名称不合法，如下字段名已经存在，建议在名称后加上数字以区分：\n"+notAllow);
		return false;
	}
	
	if((dtype=="radio" || dtype=="select" || dtype=="checkbox") && vdefault=="")
	{
		alert("你选择的select或radio、checkbox类型，必须默认值设置选择的项目（用逗号[,]分开）！");
		return false;
	}
	
	revalue =  "<field:"+fieldname+" itemname=\""+itemname+"\" autofield=\"1\" type=\""+dtype+"\" isnull=\""+sisnull+"\"";
	revalue += " default=\""+vdefault+"\" ";
	revalue += " maxlength=\""+maxlength+"\" issearch=\""+issearch+"\" isshow=\""+isshow+"\" state=\""+state+"\">\r\n"+vinnertext+"</field:"+fieldname+">\r\n";
	
	document.form1.fieldstring.value = revalue;
 
  return true;
  
}
</script>
<style type="text/css">
<!--
td {
	padding:2px;
	padding-left:6px;
	line-height:150%;
}
.STYLE1 {
	color: #FF3300
}
.STYLE2 {
	color: #666666
}
.nw {
	float:left;
	width:150px;
}
.cls {
	clear:both;
}
-->
</style>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#CFCFCF;">
  <form name="form1" action="member_model_field_add.php" method="post" onSubmit="return GetFields();">
    <input type='hidden' name='action' value='save'>
    <input type='hidden' name='id' value='<?php echo $id?>'>
    <input type='hidden' name='fieldstring' value=''>
    <tr>
      <td height="20" colspan="2" bgcolor="#EDF9D5" background="images/tbg.gif"><table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="30%">&nbsp;<b><a href="member_model_main.php">会员模型管理</a> &gt;&gt; 增加新字段：</b></td>
            <td align="right" style="padding-top:6px;"><input type="button" name="ss1" value="当前会员模型" onClick="location='member_model_edit.php?id=<?php echo $id; ?>&dopost=edit';" class="nbt"/></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#FFFFFF"><span class="STYLE1">所有填写的内容不允许包含双引号[<strong>&quot;</strong>]，否则配置将无法写入。</span></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>提示文字：</strong><br>
        <span class="STYLE2">注册修改时显示的提示文字</span></td>
      <td bgcolor="#FFFFFF"><input name="itemname" type="text" id="itemname" class="pubinputs" />
        *</td>
    </tr>
    <tr>
      <td width="28%" bgcolor="#FFFFFF"><strong>字段名称：</strong><br>
        <span class="STYLE2"> 只能用英文字母或数字，数据表的真实字段名，如果数据类型是联动类型，该项应该填写联动类型的<a href='stepselect_main.php' target='_blank'><u>[组名称]</u></a>。 </span></td>
      <td width="72%" bgcolor="#FFFFFF"><input name="fieldname" type="text" id="fieldname" class="pubinputs" />
        * </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>数据类型：</strong></td>
      <td bgcolor="#FFFFFF"><div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype1' value="text" checked='1'>
          单行文本(varchar)</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype2' value="textchar">
          单行文本(char)</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype3' value="multitext">
          多行文本</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype4' value="htmltext">
          HTML文本</div>
        <br class='cls' />
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype6' value="int">
          整数类型</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype7' value="float">
          小数类型</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype8' value="datetime">
          时间类型</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype13' value="select">
          使用option下拉框</div>
        <br class='cls' />
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype14' value="radio">
          使用radio选项卡</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype15' value="checkbox">
          Checkbox多选框</div>
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype9' value="img">
          图片</div>
        <!--div class='nw'><input type='radio' class='np' name='dtype' id='dtype10' value="imgfile">图片(仅网址)</div-->
        <!--div class='nw'><input type='radio' class='np' name='dtype' id='dtype11' value="media">多媒体文件</div-->
        <div class='nw'>
          <input type='radio' class='np' name='dtype' id='dtype12' value="addon">
          附件类型</div>
        <!--div class='nw'><input type='radio' class='np' name='dtype' id='dtype16' value="stepselect">联动类型</div--></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>默认值：</strong><br>
        <span class="STYLE2"> 如果定义数据类型为select、radio、checkbox时，此处填写被选择的项目(用“,”分开，如“男,女,人妖”)。 </span></td>
      <td bgcolor="#FFFFFF"><input name="isnull" type="hidden" value="1" /><textarea name="vdefault" type="text" id="vdefault" style="width:70%;height:60px"></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>最大长度：</strong><br>
        <span class="STYLE2"> 文本数据必须填写，大于255为text类型 </span></td>
      <td bgcolor="#FFFFFF"><input name="maxlength" type="text" id="maxlength" class="pubinputs" value="250" style="width:80px;" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>会员模型表单HTML：</strong></td>
      <td bgcolor="#FFFFFF"> ◆自定义表单HTML模板中用~name~表示提示文字，~form~表示表单元素。 </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF"></td>
      <td bgcolor="#FFFFFF"><textarea name="vinnertext" cols="45" rows="5" id="vinnertext" style="width:70%; height:120px;"></textarea></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>作为搜索条件：</strong></td>
      <td bgcolor="#FFFFFF"><input name="issearch" type="radio" class='np'  value="1" />
        是 &nbsp;
        <input name="issearch" type="radio" class='np'  value="0" checked />
        否 </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>是否在前台会员相关页面中显示：</strong></td>
      <td bgcolor="#FFFFFF"><input name="isshow" type="radio" class='np'  value="1" />
        是 &nbsp;
        <input name="isshow" type="radio" class='np'  value="0" checked />
        否 </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><strong>字段状态：</strong></td>
      <td bgcolor="#FFFFFF"><input name="state" type="radio" class='np'  value="1" checked />
        启用 &nbsp;
        <input name="state" type="radio"  value="0" class='np' />
        禁用 </td>
    </tr>
    <tr>
      <td height="28" colspan="2" bgcolor="#F9FDF0"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="26%" height="45">&nbsp;</td>
            <td width="10%"><input type="submit" name="button1" id="button1" value="确定" class="coolbg np" /></td>
            <td><input type="reset" name="button2" id="button2" value="重置" class="coolbg np" /></td>
          </tr>
        </table></td>
    </tr>
  </form>
</table>
</body>
</html>